﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

#region License
/*
 *  Copyright (c) Dumuzi.cn 2009 , All rights reserved.
 *  CLR Version: 2.0.50727.4927
 *  NameSpace: Summer.Web.Mvc
 *  Author:Edwin Tai,戴佳顺
 *  Msn:edwin19861218@hotmail.com
 *  QQ: 1961218
 *  Date:2009-11-19 15:51:07
 *  Licensed under the Microsoft Public License (Ms-PL)
 *  This license governs use of the accompanying software. 
 *  If you use the software, you accept this license.
 *  If you do not accept the license, do not use the software.
 */
#endregion

namespace Summer.Web.Mvc
{
    /// <summary>
    /// The urlRoutingModule is to route if mvc or not
    /// </summary>
    public class UrlRoutingModule : System.Web.Routing.UrlRoutingModule
    {
        public override void PostMapRequestHandler(System.Web.HttpContextBase context)
        {
            base.PostMapRequestHandler(context);
            //if mvc, the handler in context is mvcHandler,or is a handler that is a page
            System.Web.Mvc.MvcHandler mHandler = context.Handler as System.Web.Mvc.MvcHandler;
            if (mHandler != null)
            {
                //create my own mvchandler to set contextObject in its "ProcessRequest"
                MvcHandler mh = new MvcHandler(mHandler.RequestContext);
                context.Handler = mh;
            }
        }
    }
}
